import { App } from 'vue';
import { registerControlProvider } from '@ibiz-template/runtime';
import { withInstall } from '@ibiz-template/vue3-util';
import { ResourceScheduleTreeProvider } from './resource-schedule-tree.privoder';
import { ResourceScheduleTree } from './resource-schedule-tree';

const IBizResourceScheduleTree = withInstall(
  ResourceScheduleTree,
  function (v: App) {
    v.component(ResourceScheduleTree.name!, ResourceScheduleTree);
    registerControlProvider(
      'TREE_RENDER_RESOURCE_SCHEDULER_TREE',
      () => new ResourceScheduleTreeProvider(),
    );
  },
);

export default {
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
  install(app: App) {
    app.use(IBizResourceScheduleTree);
  },
};
